﻿<UserControl x:Class="VSTranslator.Adornment.TranslationAdornment"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" 
			 mc:Ignorable="d" 
			 d:DesignHeight="200" d:DesignWidth="200" 
			 TextOptions.TextFormattingMode="Display" 
             UseLayoutRounding="True"
			 Initialized="UserControl_Initialized">

	<Border BorderThickness="1" MaxWidth="600" BorderBrush="DarkGray" Background="White" Cursor="Arrow">
		<Border.Effect>
			<DropShadowEffect ShadowDepth="0" Color="DarkGray" Opacity="0.5"/>
		</Border.Effect>

		<Grid Name="grdContent">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>
            <Image Name="imgTranslator" Width="16" Height="16" HorizontalAlignment="Left" Margin="2,0,0,0" />
			<TextBlock Name="lblDirection" Text="Translating..." Margin="20,0,51,0" Padding="2" VerticalAlignment="Center" />

			<Button Name="cmdSettings" HorizontalAlignment="Right" VerticalAlignment="Center" Click="cmdSettings_Click" Margin="0,0,26,0" ToolTip="Settings">
				<Image Stretch="Fill" Width="16" Height="16" Source="/TranslatorPackage;component/Images/settings.png"/>
			</Button>
			<Button Name="cmdClose" HorizontalAlignment="Right" VerticalAlignment="Center" Click="cmdClose_Click" ToolTip="Close">
				<Image Stretch="Fill" Width="16" Height="16" Source="/TranslatorPackage;component/Images/close.png"/>
			</Button>

			<Border Grid.Row="1">
				<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" MaxHeight="600" VerticalAlignment="Top">
					<StackPanel Name="spContent"/>
				</ScrollViewer>
			</Border>
			<StackPanel HorizontalAlignment="Left" Height="100" Margin="47,17,0,-116" Grid.Row="1" VerticalAlignment="Top" Width="100"/>
		</Grid>
	</Border>

	<!--styles-->
	<UserControl.Resources>

		<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
			<Setter Property="SnapsToDevicePixels" Value="True"/>
			<Setter Property="OverridesDefaultStyle" Value="true"/>
			<Setter Property="IsTabStop" Value="false"/>
			<Setter Property="Focusable" Value="false"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type RepeatButton}">
						<Border Background="Transparent" />
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
			<Setter Property="OverridesDefaultStyle" Value="true"/>
			<Setter Property="IsTabStop" Value="false"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Thumb}">
						<Border Background="Black"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType="{x:Type ScrollBar}">
			<Setter Property="Width" Value="5" />
			<Setter Property="MinWidth" Value="5" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ScrollBar}">
						<Border Opacity="0.5" Background="Gray" Width="7">
							<Grid SnapsToDevicePixels="true">
								<Track Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}" IsDirectionReversed="true">
									<Track.DecreaseRepeatButton>
										<RepeatButton Command="ScrollBar.PageUpCommand"  Style="{StaticResource ScrollBarPageButton}"/>
									</Track.DecreaseRepeatButton>
									<Track.IncreaseRepeatButton>
										<RepeatButton Command="ScrollBar.PageDownCommand"  Style="{StaticResource ScrollBarPageButton}"/>
									</Track.IncreaseRepeatButton>
									<Track.Thumb>
										<Thumb Style="{StaticResource ScrollBarThumb}" />
									</Track.Thumb>
								</Track>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<!--scroll viewer is "redefined" too, to make custom scroll bar work in Windows 8-->
		<Style TargetType="{x:Type ScrollViewer}">			
		</Style>
		
		<Style TargetType="{x:Type Button}">			
			<Setter Property="Cursor" Value="Hand" />
			<Setter Property="Background" Value="{x:Null}" />
			<Setter Property="Foreground" Value="{x:Null}" />
			<Setter Property="Focusable" Value="False" />
			<Setter Property="IsTabStop" Value="False" />
			<Setter Property="Margin" Value="2" />	
			<Setter Property="BorderBrush" Value="{x:Null}" />
		</Style>
		
	</UserControl.Resources>

</UserControl>
